import http from '@/utils/http'

//Layout中获取头部导航分类数据
export function getCategoryApi() {
  return http({
    url: 'home/category/head',
    method: 'get',
  })
}

//获取一级分类id
export const getTopCategoryAPI = (id) => {
  return http({
    url: '/category',
    params: {
      id,
    },
  })
}

//获取二级分类导航列表
export const getCategoryFilterAPI = (id) => {
  return http({
    url: '/category/sub/filter',
    params: {
      id,
    },
  })
}

//获取二级分类
/**
 *
 * { 
     categoryId: 1005000 ,
     page: 1,
     pageSize: 20,
     sortField: 'publishTime' | 'orderNum' | 'evaluateNum'
   } 
 * 
 */
export const getSubCategoryAPI = (data) => {
  return http({
    url: '/category/goods/temporary',
    method: 'POST',
    data,
  })
}
